﻿using GreenXi.ViewModel;
using System;
using System.Windows;
using System.Windows.Input;

namespace GreenXi.Pages.Setting
{
    /// <summary>
    /// Craft_Edit.xaml 的交互逻辑
    /// </summary>
    public partial class Craft_Edit : Window
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Type">类型 0起始值 1终止值</param>
        public Craft_Edit()
        {
            InitializeComponent();
            DataContext = new CraftEditViewModel();
        }

        private void Close_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.Close();
        }
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);
            this.DragMove();
        }
        private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            short val;
            if (!Int16.TryParse(e.Text, out val))
                e.Handled = true;
        }

        private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Space)
                e.Handled = true;
        }
    }
}
